(function(j, e, b) {
        var f = o = mobiscroll,
            a = f.$,
            h = f.presets.scroller,
            d = f.util,
            k = d.datetime.adjustedDate,
            H = d.jsPrefix,
            x = d.testTouch,
            p = d.getCoord,
            m = {
                controls: ["calendar"],
                firstDay: 0,
                weekDays: "short",
                maxMonthWidth: 170,
                months: 1,
                preMonths: 1,
                highlight: !0,
                outerMonthChange: !0,
                quickNav: !0,
                yearChange: !0,
                todayClass: "mbsc-cal-today",
                btnCalPrevClass: "mbsc-ic mbsc-ic-arrow-left6",
                btnCalNextClass: "mbsc-ic mbsc-ic-arrow-right6",
                dateText: "Date",
                timeText: "Time",
                calendarText: "Calendar",
                todayText: "Today",
                prevMonthText: "Previous Month",
                nextMonthText: "Next Month",
                prevYearText: "Previous Year",
                nextYearText: "Next Year"
            };
        h.calbase = function(g) {
            function j(b) {
                var c;
                Za = a(this);
                Db = !1;
                "keydown" != b.type ? (jb = p(b, "X"), Nb = p(b, "Y"), c = x(b, this)) : c = 32 === b.keyCode;
                if (!Xa && c && !Za.hasClass("mbsc-fr-btn-d") && (Xa = !0, setTimeout(t,
                        100), "mousedown" == b.type)) a(e).on("mousemove", E).on("mouseup", u)
            }

            function E(a) {
                if (7 < Math.abs(jb - p(a, "X")) || 7 < Math.abs(Nb - p(a, "Y"))) Xa = !1, Za.removeClass("mbsc-fr-btn-a")
            }

			function t() {
                Db = !0;
                Za.hasClass("mbsc-cal-prev-m") ? L() : Za.hasClass("mbsc-cal-next-m") ? w() : Za.hasClass("mbsc-cal-prev-y") ? S(Za) : Za.hasClass("mbsc-cal-next-y") && V(Za)
            }
			
            function u(b) {
                "touchend" == b.type && b.preventDefault();
                Za && !Db && t();
                Xa = !1;
                "mouseup" == b.type && a(e).off("mousemove", E).off("mouseup", u)
            }

            function D(b, c, d) {
                var g, e, f, h, i = {},
                    j =
                    va + mb;
                b && a.each(b, function(a, b) {
                    g = b.d || b.start || b;
                    e = g + "";
                    if (b.start && b.end)
                        for (h = new Date(b.start); h <= b.end;) f = k(h.getFullYear(), h.getMonth(), h.getDate()), i[f] = i[f] || [], i[f].push(b), h.setDate(h.getDate() + 1);
                    else if (g.getTime) f = k(g.getFullYear(), g.getMonth(), g.getDate()), i[f] = i[f] || [], i[f].push(b);
                    else if (e.match(/w/i)) {
                        var l = +e.replace("w", ""),
                            s = 0,
                            n = z.getDate(c, d - va - ua, 1).getDay();
                        1 < z.firstDay - n + 1 && (s = 7);
                        for (Z = 0; Z < 5 * Ma; Z++) f = z.getDate(c, d - va - ua, 7 * Z - s - n + 1 + l), i[f] = i[f] || [], i[f].push(b)
                    } else if (e = e.split("/"),
                        e[1]) 11 <= d + j && (f = z.getDate(c + 1, e[0] - 1, e[1]), i[f] = i[f] || [], i[f].push(b)), 1 >= d - j && (f = z.getDate(c - 1, e[0] - 1, e[1]), i[f] = i[f] || [], i[f].push(b)), f = z.getDate(c, e[0] - 1, e[1]), i[f] = i[f] || [], i[f].push(b);
                    else
                        for (Z = 0; Z < Ma; Z++) f = z.getDate(c, d - va - ua + Z, e[0]), z.getDay(f) == e[0] && (i[f] = i[f] || [], i[f].push(b))
                });
                return i
            }

            function c(a, b) {
                Ka = D(z.invalid, a, b);
                Lb = D(z.valid, a, b);
                g.onGenMonth(a, b)
            }

            function r(a, b, c, d, g, e, f) {
                var h = '<div class="mbsc-cal-h mbsc-cal-sc-c mbsc-cal-' + a + "-c " + (z.calendarClass || "") + '"><div class="mbsc-cal-sc"><div class="mbsc-cal-sc-p"><div class="mbsc-cal-sc-tbl"><div class="mbsc-cal-sc-row">';
                for (y = 1; y <= b; y++) h = 12 >= y || y > c ? h + '<div class="mbsc-cal-sc-m-cell mbsc-cal-sc-cell mbsc-cal-sc-empty"><div class="mbsc-cal-sc-cell-i">&nbsp;</div></div>' : h + ('<div tabindex="0" role="button"' + (e ? ' aria-label="' + e[y - 13] + '"' : "") + ' class="mbsc-fr-btn-e mbsc-fr-btn-nhl mbsc-cal-sc-m-cell mbsc-cal-sc-cell mbsc-cal-' + a + '-s" data-val=' + (d + y - 13) + '><div class="mbsc-cal-sc-cell-i mbsc-cal-sc-tbl"><div class="mbsc-cal-sc-cell">' + (f ? f[y - 13] : d + y - 13 + g) + "</div></div></div>"), y < b && (0 === y % 12 ? h += '</div></div></div><div class="mbsc-cal-sc-p" style="' +
                    (La ? "top" : Aa ? "right" : "left") + ":" + 100 * Math.round(y / 12) + '%"><div class="mbsc-cal-sc-tbl"><div class="mbsc-cal-sc-row">' : 0 === y % 3 && (h += '</div><div class="mbsc-cal-sc-row">'));
                return h + "</div></div></div></div></div>"
            }

            function i(c, d) {
                var e, f, h, i, j, l, s, n, m, q, A, y, F, P, p = 1,
                    C = 0;
                e = z.getDate(c, d, 1);
                var w = z.getYear(e),
                    X = z.getMonth(e),
                    u = null === z.defaultValue && !g._hasValue ? null : g.getDate(!0),
                    G = z.getDate(w, X, 1).getDay(),
                    t = '<div class="mbsc-cal-table">',
                    r = '<div class="mbsc-cal-week-nr-c">';
                1 < z.firstDay - G + 1 && (C = 7);
                for (P = 0; 42 > P; P++) F = P + z.firstDay - C, e = z.getDate(w, X, F - G + 1), f = e.getFullYear(), h = e.getMonth(), i = e.getDate(), j = z.getMonth(e), l = z.getDay(e), y = z.getMaxDayOfMonth(f, h), s = f + "-" + h + "-" + i, h = a.extend({
                    valid: e < k(hb.getFullYear(), hb.getMonth(), hb.getDate()) || e > nb ? !1 : Ka[e] === b || Lb[e] !== b,
                    selected: u && u.getFullYear() === f && u.getMonth() === h && u.getDate() === i
                }, g.getDayProps(e, u)), n = h.valid, m = h.selected, f = h.cssClass, q = (new Date(e)).setHours(12, 0, 0, 0) === (new Date).setHours(12, 0, 0, 0), A = j !== X, Qb[s] = h, 0 === P % 7 && (t += (P ? "</div>" :
                    "") + '<div class="mbsc-cal-row' + (z.highlight && u && 0 <= u - e && 6048E5 > u - e ? " mbsc-cal-week-hl" : "") + '">'), Ia && 1 == e.getDay() && ("month" == Ia && A && 1 < p ? p = 1 == i ? 1 : 2 : "year" == Ia && (p = z.getWeekNumber(e)), r += '<div class="mbsc-cal-week-nr"><div class="mbsc-cal-week-nr-i">' + p + "</div></div>", p++), t += '<div role="button" tabindex="-1" aria-label="' + (q ? z.todayText + ", " : "") + z.dayNames[e.getDay()] + ", " + z.monthNames[j] + " " + l + " " + (h.ariaLabel ? ", " + h.ariaLabel : "") + '"' + (A && !wb ? ' aria-hidden="true"' : "") + (m ? ' aria-selected="true"' :
                    "") + (n ? "" : ' aria-disabled="true"') + ' data-day="' + F % 7 + '" data-full="' + s + '"class="mbsc-cal-day ' + (z.dayClass || "") + (m ? " mbsc-cal-day-sel" : "") + (q ? " " + z.todayClass : "") + (f ? " " + f : "") + (1 == l ? " mbsc-cal-day-first" : "") + (l == y ? " mbsc-cal-day-last" : "") + (A ? " mbsc-cal-day-diff" : "") + (n ? " mbsc-cal-day-v mbsc-fr-btn-e mbsc-fr-btn-nhl" : " mbsc-cal-day-inv") + '"><div class="mbsc-cal-day-i ' + (m ? cb : "") + " " + (z.innerDayClass || "") + '"><div class="mbsc-cal-day-fg">' + l + "</div>" + (h.markup || "") + '<div class="mbsc-cal-day-frame"></div></div></div>';
                return t + ("</div></div>" + r + "</div>")
            }

            function v(b, c, d) {
                var g = z.getDate(b, c, 1),
                    e = z.getYear(g),
                    g = z.getMonth(g),
                    f = e + ob;
                if (bb) {
                    gb && gb.removeClass("mbsc-cal-sc-sel").removeAttr("aria-selected").find(".mbsc-cal-sc-cell-i").removeClass(cb);
                    Ta && Ta.removeClass("mbsc-cal-sc-sel").removeAttr("aria-selected").find(".mbsc-cal-sc-cell-i").removeClass(cb);
                    gb = a('.mbsc-cal-year-s[data-val="' + e + '"]', N).addClass("mbsc-cal-sc-sel").attr("aria-selected", "true");
                    Ta = a('.mbsc-cal-month-s[data-val="' + g + '"]', N).addClass("mbsc-cal-sc-sel").attr("aria-selected",
                        "true");
                    gb.find(".mbsc-cal-sc-cell-i").addClass(cb);
                    Ta.find(".mbsc-cal-sc-cell-i").addClass(cb);
                    ab && ab.scroll(gb, d);
                    a(".mbsc-cal-month-s", N).removeClass("mbsc-fr-btn-d");
                    if (e === ga)
                        for (y = 0; y < Ba; y++) a('.mbsc-cal-month-s[data-val="' + y + '"]', N).addClass("mbsc-fr-btn-d");
                    if (e === Ua)
                        for (y = Qa + 1; 12 >= y; y++) a('.mbsc-cal-month-s[data-val="' + y + '"]', N).addClass("mbsc-fr-btn-d")
                }
                1 == na.length && na.attr("aria-label", e).html(f);
                for (y = 0; y < ka; ++y) g = z.getDate(b, c - ua + y, 1), e = z.getYear(g), g = z.getMonth(g), f = e + ob, a(ja[y]).attr("aria-label",
                    z.monthNames[g] + (Ga ? "" : " " + e)).html((!Ga && Pa < F ? f + " " : "") + J[g] + (!Ga && Pa > F ? " " + f : "")), 1 < na.length && a(na[y]).html(f);
                z.getDate(b, c - ua - 1, 1) < Ra ? I(a(".mbsc-cal-prev-m", N)) : M(a(".mbsc-cal-prev-m", N));
                z.getDate(b, c + ka - ua, 1) > ya ? I(a(".mbsc-cal-next-m", N)) : M(a(".mbsc-cal-next-m", N));
                z.getDate(b, c, 1).getFullYear() <= Ra.getFullYear() ? I(a(".mbsc-cal-prev-y", N)) : M(a(".mbsc-cal-prev-y", N));
                z.getDate(b, c, 1).getFullYear() >= ya.getFullYear() ? I(a(".mbsc-cal-next-y", N)) : M(a(".mbsc-cal-next-y", N))
            }

            function M(a) {
                a.removeClass($a).find(".mbsc-cal-btn-txt").removeAttr("aria-disabled")
            }

            function I(a) {
                a.addClass($a).find(".mbsc-cal-btn-txt").attr("aria-disabled", "true")
            }

            function K(b, c) {
                if (ia && ("calendar" === Ca || c)) {
                    var d, e, f = z.getDate(oa, sa, 1),
                        h = Math.abs(12 * (z.getYear(b) - z.getYear(f)) + z.getMonth(b) - z.getMonth(f));
                    g.needsSlide && h && (oa = z.getYear(b), sa = z.getMonth(b), b > f ? (e = h > va - ua + ka - 1, sa -= e ? 0 : h - va, d = "next") : b < f && (e = h > va + ua, sa += e ? 0 : h - va, d = "prev"), s(oa, sa, d, Math.min(h, va), e, !0));
                    c || (ib = b, g.trigger("onDayHighlight", {
                        date: b
                    }), z.highlight && (a(".mbsc-cal-day-sel .mbsc-cal-day-i", ha).removeClass(cb),
                        a(".mbsc-cal-day-sel", ha).removeClass("mbsc-cal-day-sel").removeAttr("aria-selected"), a(".mbsc-cal-week-hl", ha).removeClass("mbsc-cal-week-hl"), (null !== z.defaultValue || g._hasValue) && a('.mbsc-cal-day[data-full="' + b.getFullYear() + "-" + b.getMonth() + "-" + b.getDate() + '"]', ha).addClass("mbsc-cal-day-sel").attr("aria-selected", "true").find(".mbsc-cal-day-i").addClass(cb).closest(".mbsc-cal-row").addClass("mbsc-cal-week-hl")));
                    g.needsSlide = !0
                }
            }

            function n(a, d, e) {
                e || g.trigger("onMonthLoading", {
                    year: a,
                    month: d
                });
                c(a, d);
                for (y = 0; y < Ma; y++) xa[y].html(i(a, d - ua - va + y));
                q();
                sb = b;
                g.trigger("onMonthLoaded", {
                    year: a,
                    month: d
                })
            }

            function l(b, c, d) {
                var g = va,
                    e = va;
                if (d) {
                    for (; e && z.getDate(b, c + g + ka - ua - 1, 1) > ya;) e--;
                    for (; g && z.getDate(b, c - e - ua, 1) < Ra;) g--
                }
                a.extend(la.settings, {
                    contSize: ka * Y,
                    snap: Y,
                    minScroll: R - (Aa ? g : e) * Y,
                    maxScroll: R + (Aa ? e : g) * Y
                });
                la.refresh()
            }

            function q() {
                Ia && ta.html(a(".mbsc-cal-week-nr-c", xa[va]).html());
                a(".mbsc-cal-slide-a .mbsc-cal-day", qa).attr("tabindex", 0)
            }

            function s(d, e, f, h, j, k, m) {
                d && rb.push({
                    y: d,
                    m: e,
                    dir: f,
                    slideNr: h,
                    load: j,
                    active: k,
                    callback: m
                });
                if (!Oa) {
                    var A = rb.shift(),
                        d = A.y,
                        e = A.m,
                        f = "next" === A.dir,
                        h = A.slideNr,
                        j = A.load,
                        k = A.active,
                        m = A.callback || Ib,
                        A = z.getDate(d, e, 1),
                        d = z.getYear(A),
                        e = z.getMonth(A);
                    Oa = !0;
                    g.changing = !0;
                    g.trigger("onMonthChange", {
                        year: d,
                        month: e
                    });
                    g.trigger("onMonthLoading", {
                        year: d,
                        month: e
                    });
                    c(d, e);
                    if (j)
                        for (y = 0; y < ka; y++) xa[f ? Ma - ka + y : y].html(i(d, e - ua + y));
                    k && yb.addClass("mbsc-cal-slide-a");
                    setTimeout(function() {
                        g.ariaMessage(z.monthNames[e] + " " + d);
                        v(d, e, 200);
                        R = f ? R - Y * h * wa : R + Y * h * wa;
                        la.scroll(R,
                            k ? 200 : 0, !1,
                            function() {
                                var c;
                                if (xa.length) {
                                    yb.removeClass("mbsc-cal-slide-a").attr("aria-hidden", "true");
                                    if (f) {
                                        c = xa.splice(0, h);
                                        for (y = 0; y < h; y++) {
                                            xa.push(c[y]);
                                            C(xa[xa.length - 1], +xa[xa.length - 2].attr("data-curr") + 100 * wa)
                                        }
                                    } else {
                                        c = xa.splice(Ma - h, h);
                                        for (y = h - 1; y >= 0; y--) {
                                            xa.unshift(c[y]);
                                            C(xa[0], +xa[1].attr("data-curr") - 100 * wa)
                                        }
                                    }
                                    for (y = 0; y < h; y++) {
                                        xa[f ? Ma - h + y : y].html(i(d, e - ua - va + y + (f ? Ma - h : 0)));
                                        j && xa[f ? y : Ma - h + y].html(i(d, e - ua - va + y + (f ? 0 : Ma - h)))
                                    }
                                    for (y = 0; y < ka; y++) xa[va + y].addClass("mbsc-cal-slide-a").removeAttr("aria-hidden");
                                    l(d, e, true);
                                    Oa = false
                                }
                                if (rb.length) setTimeout(function() {
                                    s()
                                }, 10);
                                else {
                                    oa = d;
                                    sa = e;
                                    g.changing = false;
                                    a(".mbsc-cal-day", qa).attr("tabindex", -1);
                                    q();
                                    sb !== b ? n(d, e, sb) : g.trigger("onMonthLoaded", {
                                        year: d,
                                        month: e
                                    });
                                    m()
                                }
                            })
                    }, 10)
                }
            }

            function U() {
                var b = a(this),
                    c = g.live,
                    d = g.getDate(!0),
                    e = b.attr("data-full"),
                    f = e.split("-"),
                    f = k(f[0], f[1], f[2]),
                    d = k(f.getFullYear(), f.getMonth(), f.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()),
                    h = b.hasClass("mbsc-cal-day-sel");
                if ((wb || !b.hasClass("mbsc-cal-day-diff")) && !1 !== g.trigger("onDayChange",
                        a.extend(Qb[e], {
                            date: d,
                            target: this,
                            selected: h
                        }))) g.needsSlide = !1, pa = !0, g.setDate(d, c, 0.2, !c, !0), z.outerMonthChange && (Xa = !0, f < z.getDate(oa, sa - ua, 1) ? L() : f > z.getDate(oa, sa - ua + ka, 0) && w(), Xa = !1), g.live && g.trigger("onSet", {
                    valueText: g._value
                })
            }

            function C(a, b) {
                a.attr("data-curr", b);
                a[0].style[H + "Transform"] = "translate3d(" + (La ? "0," + b + "%," : b + "%,0,") + "0)"
            }

            function G(a) {
                g.isVisible() && ia && (g.changing ? sb = a : n(oa, sa, a))
            }

            function w() {
                Xa && z.getDate(oa, sa + ka - ua, 1) <= ya && o.running && s(oa, ++sa, "next", 1, !1, !0, w)
            }

            function L() {
                Xa &&
                    z.getDate(oa, sa - ua - 1, 1) >= Ra && o.running && s(oa, --sa, "prev", 1, !1, !0, L)
            }

            function V(a) {
                Xa && z.getDate(oa, sa, 1) <= z.getDate(z.getYear(ya) - 1, z.getMonth(ya) - mb, 1) && o.running ? s(++oa, sa, "next", va, !0, !0, function() {
                    V(a)
                }) : Xa && !a.hasClass("mbsc-fr-btn-d") && o.running && s(z.getYear(ya), z.getMonth(ya) - mb, "next", va, !0, !0)
            }

            function S(a) {
                Xa && z.getDate(oa, sa, 1) >= z.getDate(z.getYear(Ra) + 1, z.getMonth(Ra) + ua, 1) && o.running ? s(--oa, sa, "prev", va, !0, !0, function() {
                    S(a)
                }) : Xa && !a.hasClass("mbsc-fr-btn-d") && o.running && s(z.getYear(Ra),
                    z.getMonth(Ra) + ua, "prev", va, !0, !0)
            }

            function T(a, b) {
                a.hasClass("mbsc-cal-v") || (a.addClass("mbsc-cal-v" + (b ? "" : " mbsc-cal-p-in")).removeClass("mbsc-cal-p-out mbsc-cal-h"), g.trigger("onSelectShow"))
            }

            function A(a, b) {
                a.hasClass("mbsc-cal-v") && a.removeClass("mbsc-cal-v mbsc-cal-p-in").addClass("mbsc-cal-h" + (b ? "" : " mbsc-cal-p-out"))
            }

            function W(a, b) {
                (b || a).hasClass("mbsc-cal-v") ? A(a) : T(a)
            }

            function ba() {
                a(this).removeClass("mbsc-cal-p-out mbsc-cal-p-in")
            }
            var P, y, Z, ma, ea, N, da, ha, qa, Y, R, pa, ia, Q, ra, ta, O, fa, J,
                la, X, ja, F, na, Pa, ga, Ua, Ba, Qa, Ra, ya, hb, nb, ib, oa, sa, zb, lb, Lb, Ka, Va, Ca, Oa, jb, Nb, Za, Db, Xa, ka, Ma, mb, ua, sb, wb, ab, gb, Ta, Ob = this,
                yb = [],
                xa = [],
                rb = [],
                Da = {},
                Qb = {},
                Ib = function() {},
                Pb = a.extend({}, g.settings),
                z = a.extend(g.settings, m, Pb),
                xb = "full" == z.weekDays ? "" : "min" == z.weekDays ? "Min" : "Short",
                Ia = z.weekCounter,
                Ha = z.layout || (/top|bottom/.test(z.display) ? "liquid" : ""),
                Sa = "liquid" == Ha && "bubble" !== z.display,
                aa = "center" == z.display,
                Aa = z.rtl,
                wa = Aa ? -1 : 1,
                Cb = Sa ? null : z.calendarWidth,
                La = "vertical" == z.calendarScroll,
                bb = z.quickNav,
                va = z.preMonths,
                Ga = z.yearChange,
                db = z.controls.join(","),
                eb = (!0 === z.tabs || !1 !== z.tabs && Sa) && 1 < z.controls.length,
                tb = !eb && z.tabs === b && !Sa && 1 < z.controls.length,
                ob = z.yearSuffix || "",
                cb = z.activeClass || "",
                Bb = "mbsc-cal-tab-sel " + (z.activeTabClass || ""),
                ub = z.activeTabInnerClass || "",
                $a = "mbsc-fr-btn-d " + (z.disabledClass || ""),
                za = "",
                Fa = "";
            db.match(/calendar/) ? ia = !0 : bb = !1;
            db.match(/date/) && (Da.date = 1);
            db.match(/time/) && (Da.time = 1);
            ia && Da.date && (eb = !0, tb = !1);
            z.layout = Ha;
            z.preset = (Da.date || ia ? "date" : "") + (Da.time ? "time" :
                "");
            if ("inline" == z.display) a(this).closest('[data-role="page"]').on("pageshow", function() {
                g.position()
            });
            g.changing = !1;
            g.needsSlide = !0;
            g.getDayProps = Ib;
            g.onGenMonth = Ib;
            g.prepareObj = D;
            g.refresh = function() {
                G(false)
            };
            g.redraw = function() {
                G(true)
            };
            g.navigate = function(a, b) {
                var c, d, e = g.isVisible();
                if (b && e) K(a, true);
                else {
                    c = z.getYear(a);
                    d = z.getMonth(a);
                    if (e && (c != oa || d != sa)) {
                        g.trigger("onMonthChange", {
                            year: c,
                            month: d
                        });
                        v(c, d);
                        n(c, d);
                        l(a.getFullYear(), a.getMonth(), true)
                    }
                    oa = c;
                    sa = d
                }
            };
            g.showMonthView = function() {
                if (bb &&
                    !fa) {
                    A(Fa, true);
                    A(za, true);
                    T(O, true);
                    fa = true
                }
            };
            g.changeTab = function(b) {
                if (g._isVisible && Da[b] && Ca != b) {
                    Ca = b;
                    a(".mbsc-cal-pnl", N).removeClass("mbsc-cal-p-in").addClass("mbsc-cal-pnl-h");
                    a(".mbsc-cal-tab", N).removeClass(Bb).removeAttr("aria-selected").find(".mbsc-cal-tab-i").removeClass(ub);
                    a('.mbsc-cal-tab[data-control="' + b + '"]', N).addClass(Bb).attr("aria-selected", "true").find(".mbsc-cal-tab-i").addClass(ub);
                    Da[Ca].removeClass("mbsc-cal-pnl-h").addClass("mbsc-cal-p-in");
                    if (Ca == "calendar") {
                        P = g.getDate(true);
                        (P.getFullYear() !== ib.getFullYear() || P.getMonth() !== ib.getMonth() || P.getDate() !== ib.getDate()) && K(P)
                    }
                    g.showMonthView();
                    g.trigger("onTabChange", {
                        tab: Ca
                    })
                }
            };
            ma = h.datetime.call(this, g);
            F = z.dateFormat.search(/m/i);
            Pa = z.dateFormat.search(/y/i);
            a.extend(ma, {
                ariaMessage: z.calendarText,
                onMarkupReady: function(c) {
                    var e, h = "";
                    N = a(c.target);
                    da = z.display == "inline" ? a(this).is("div") ? a(this) : a(this).parent() : g._window;
                    ib = g.getDate(true);
                    if (!oa) {
                        oa = z.getYear(ib);
                        sa = z.getMonth(ib)
                    }
                    R = 0;
                    ra = true;
                    Oa = false;
                    J = z.monthNames;
                    Ca = "calendar";
                    if (z.min) {
                        Ra = k(z.min.getFullYear(), z.min.getMonth(), 1);
                        hb = z.min
                    } else hb = Ra = k(z.startYear, 0, 1);
                    if (z.max) {
                        ya = k(z.max.getFullYear(), z.max.getMonth(), 1);
                        nb = z.max
                    } else nb = ya = k(z.endYear, 11, 31, 23, 59, 59);
                    N.addClass("mbsc-calendar");
                    ea = a(".mbsc-fr-popup", N);
                    Va = a(".mbsc-fr-c", N);
                    Da.date ? Da.date = a(".mbsc-sc-whl-gr-c", N).eq(0) : ia && a(".mbsc-sc-whl-gr-c", N).eq(0).addClass("mbsc-cal-hdn");
                    if (Da.time) Da.time = a(".mbsc-sc-whl-gr-c", N).eq(1);
                    if (ia) {
                        ka = z.months == "auto" ? Math.max(1, Math.min(3, Math.floor((Cb ||
                            da[0].innerWidth || da.innerWidth()) / 280))) : z.months;
                        Ma = ka + 2 * va;
                        mb = Math.floor(ka / 2);
                        ua = Math.round(ka / 2) - 1;
                        wb = z.showOuterDays === b ? ka < 2 : z.showOuterDays;
                        La = La && ka < 2;
                        c = '<div class="mbsc-cal-btnw"><div class="' + (Aa ? "mbsc-cal-next-m" : "mbsc-cal-prev-m") + ' mbsc-cal-prev mbsc-cal-btn mbsc-fr-btn mbsc-fr-btn-e"><div role="button" tabindex="0" class="mbsc-cal-btn-txt ' + (z.btnCalPrevClass || "") + '" aria-label="' + z.prevMonthText + '"></div></div>';
                        for (y = 0; y < ka; ++y) c = c + ('<div class="mbsc-cal-btnw-m" style="width: ' +
                            100 / ka + '%"><span role="button" class="mbsc-cal-month"></span></div>');
                        c = c + ('<div class="' + (Aa ? "mbsc-cal-prev-m" : "mbsc-cal-next-m") + ' mbsc-cal-next mbsc-cal-btn mbsc-fr-btn mbsc-fr-btn-e"><div role="button" tabindex="0" class="mbsc-cal-btn-txt ' + (z.btnCalNextClass || "") + '" aria-label="' + z.nextMonthText + '"></div></div></div>');
                        Ga && (h = '<div class="mbsc-cal-btnw"><div class="' + (Aa ? "mbsc-cal-next-y" : "mbsc-cal-prev-y") + ' mbsc-cal-prev mbsc-cal-btn mbsc-fr-btn mbsc-fr-btn-e"><div role="button" tabindex="0" class="mbsc-cal-btn-txt ' +
                            (z.btnCalPrevClass || "") + '" aria-label="' + z.prevYearText + '"></div></div><span role="button" class="mbsc-cal-year"></span><div class="' + (Aa ? "mbsc-cal-prev-y" : "mbsc-cal-next-y") + ' mbsc-cal-next mbsc-cal-btn mbsc-fr-btn mbsc-fr-btn-e"><div role="button" tabindex="0" class="mbsc-cal-btn-txt ' + (z.btnCalNextClass || "") + '" aria-label="' + z.nextYearText + '"></div></div></div>');
                        if (bb) {
                            ga = z.getYear(Ra);
                            Ua = z.getYear(ya);
                            Ba = z.getMonth(Ra);
                            Qa = z.getMonth(ya);
                            lb = Math.ceil((Ua - ga + 1) / 12) + 2;
                            za = r("month", 36, 24, 0, "", z.monthNames,
                                z.monthNamesShort);
                            Fa = r("year", lb * 12, Ua - ga + 13, ga, ob)
                        }
                        Q = '<div class="mbsc-w-p mbsc-cal-c"><div class="mbsc-cal mbsc-cal-hl-now' + (ka > 1 ? " mbsc-cal-multi " : "") + (Ia ? " mbsc-cal-weeks " : "") + (La ? " mbsc-cal-vertical" : "") + (wb ? "" : " mbsc-cal-hide-diff ") + (z.calendarClass || "") + '"><div class="mbsc-cal-header"><div class="mbsc-cal-btnc ' + (Ga ? "mbsc-cal-btnc-ym" : "mbsc-cal-btnc-m") + '">' + (Pa < F || ka > 1 ? h + c : c + h) + '</div></div><div class="mbsc-cal-body"><div class="mbsc-cal-m-c mbsc-cal-v"><div class="mbsc-cal-days-c">';
                        for (Z = 0; Z < ka; ++Z) {
                            Q = Q + ('<div aria-hidden="true" class="mbsc-cal-days" style="width: ' + 100 / ka + '%"><table cellpadding="0" cellspacing="0"><tr>');
                            for (y = 0; y < 7; y++) Q = Q + ("<th>" + z["dayNames" + xb][(y + z.firstDay) % 7] + "</th>");
                            Q = Q + "</tr></table></div>"
                        }
                        Q = Q + ('</div><div class="mbsc-cal-week-nrs-c ' + (z.weekNrClass || "") + '"><div class="mbsc-cal-week-nrs"></div></div><div class="mbsc-cal-anim-c ' + (z.calendarClass || "") + '"><div class="mbsc-cal-anim">');
                        for (y = 0; y < ka + 2 * va; y++) Q = Q + '<div class="mbsc-cal-slide" aria-hidden="true"></div>';
                        Q = Q + ("</div></div></div>" + za + Fa + "</div></div></div>");
                        Da.calendar = a(Q)
                    }
                    a.each(z.controls, function(b, c) {
                        Da[c] = a('<div class="mbsc-cal-pnl" id="' + (Ob.id + "_dw_pnl_" + b) + '"></div>').append(a('<div class="mbsc-cal-pnl-i"></div>').append(Da[c])).appendTo(Va)
                    });
                    e = '<div class="mbsc-cal-tabs"><ul role="tablist">';
                    a.each(z.controls, function(a, b) {
                        Da[b] && (e = e + ('<li role="tab" aria-controls="' + (Ob.id + "_dw_pnl_" + a) + '" class="mbsc-cal-tab ' + (a ? "" : Bb) + '" data-control="' + b + '"><a href="#" class="mbsc-fr-btn-e mbsc-fr-btn-nhl mbsc-cal-tab-i ' +
                            (!a ? ub : "") + '">' + z[b + "Text"] + "</a></li>"))
                    });
                    e = e + "</ul></div>";
                    Va.before(e);
                    ha = a(".mbsc-cal-anim-c", N);
                    qa = a(".mbsc-cal-anim", ha);
                    ta = a(".mbsc-cal-week-nrs", N);
                    if (ia) {
                        fa = true;
                        yb = a(".mbsc-cal-slide", qa).each(function(b, c) {
                            xa.push(a(c))
                        });
                        yb.slice(va, va + ka).addClass("mbsc-cal-slide-a").removeAttr("aria-hidden");
                        for (y = 0; y < Ma; y++) C(xa[y], 100 * (y - va) * wa);
                        n(oa, sa);
                        la = new f.classes.ScrollView(ha[0], {
                            axis: La ? "Y" : "X",
                            easing: "",
                            contSize: 0,
                            snap: 1,
                            maxSnapScroll: va,
                            moveElement: qa,
                            mousewheel: z.mousewheel,
                            time: 200,
                            lock: true,
                            stopProp: false,
                            onAnimationEnd: function(a) {
                                (a = Math.round(((La ? a.posY : a.posX) - R) / Y) * wa) && s(oa, sa - a, a > 0 ? "prev" : "next", a > 0 ? a : -a)
                            }
                        })
                    }
                    ja = a(".mbsc-cal-month", N);
                    na = a(".mbsc-cal-year", N);
                    O = a(".mbsc-cal-m-c", N);
                    if (bb) {
                        O.on("webkitAnimationEnd animationend", ba);
                        za = a(".mbsc-cal-month-c", N).on("webkitAnimationEnd animationend", ba);
                        Fa = a(".mbsc-cal-year-c", N).on("webkitAnimationEnd animationend", ba);
                        a(".mbsc-cal-sc-p", N);
                        zb = {
                            axis: La ? "Y" : "X",
                            contSize: 0,
                            snap: 1,
                            maxSnapScroll: 1,
                            rtl: z.rtl,
                            mousewheel: z.mousewheel,
                            time: 200
                        };
                        ab = new f.classes.ScrollView(Fa[0], zb);
                        X = new f.classes.ScrollView(za[0], zb)
                    }
                    Sa ? N.addClass("mbsc-cal-liq") : a(".mbsc-cal", N).width(Cb || 280 * ka);
                    z.calendarHeight && a(".mbsc-cal-anim-c", N).height(z.calendarHeight);
                    g.tap(ha, function(b) {
                        b = a(b.target);
                        if (!Oa && !la.scrolled && z.readonly !== true) {
                            b = b.closest(".mbsc-cal-day", this);
                            b.hasClass("mbsc-cal-day-v") && U.call(b[0])
                        }
                    });
                    a(".mbsc-cal-btn", N).on("touchstart mousedown keydown", j).on("touchmove", E).on("touchend touchcancel keyup", u);
                    a(".mbsc-cal-tab",
                        N).on("touchstart click", function(b) {
                        x(b, this) && o.running && g.changeTab(a(this).attr("data-control"))
                    });
                    if (bb) {
                        g.tap(a(".mbsc-cal-month", N), function() {
                            if (!Fa.hasClass("mbsc-cal-v")) {
                                W(O);
                                fa = O.hasClass("mbsc-cal-v")
                            }
                            W(za);
                            A(Fa)
                        });
                        g.tap(a(".mbsc-cal-year", N), function() {
                            Fa.hasClass("mbsc-cal-v") || ab.scroll(gb);
                            if (!za.hasClass("mbsc-cal-v")) {
                                W(O);
                                fa = O.hasClass("mbsc-cal-v")
                            }
                            W(Fa);
                            A(za)
                        });
                        g.tap(a(".mbsc-cal-month-s", N), function() {
                            !X.scrolled && !a(this).hasClass("mbsc-fr-btn-d") && g.navigate(z.getDate(oa,
                                a(this).attr("data-val"), 1))
                        });
                        g.tap(a(".mbsc-cal-year-s", N), function() {
                            if (!ab.scrolled) {
                                P = z.getDate(a(this).attr("data-val"), sa, 1);
                                g.navigate(new Date(d.constrain(P, Ra, ya)))
                            }
                        });
                        g.tap(Fa, function() {
                            if (!ab.scrolled) {
                                A(Fa);
                                T(O);
                                fa = true
                            }
                        });
                        g.tap(za, function() {
                            if (!X.scrolled) {
                                A(za);
                                T(O);
                                fa = true
                            }
                        })
                    }
                },
                onShow: function() {
                    ia && v(oa, sa)
                },
                onPosition: function(b) {
                    var c, d, e, f = 0,
                        h = 0,
                        i = 0,
                        j = b.windowHeight;
                    if (Sa) {
                        aa && ha.height("");
                        Va.height("");
                        qa.width("")
                    }
                    Y && (e = Y);
                    ia && (Y = Math.round(Math.round(ha[0][La ? "offsetHeight" :
                        "offsetWidth"
                    ]) / ka));
                    if (Y) {
                        N.removeClass("mbsc-cal-m mbsc-cal-l");
                        Y > 1024 ? N.addClass("mbsc-cal-l") : Y > 640 && N.addClass("mbsc-cal-m")
                    }
                    if (eb && (ra || Sa) || tb) {
                        a(".mbsc-cal-pnl", N).removeClass("mbsc-cal-pnl-h");
                        a.each(Da, function(a, b) {
                            c = b[0].offsetWidth;
                            f = Math.max(f, c);
                            h = Math.max(h, b[0].offsetHeight);
                            i = i + c
                        });
                        if (eb || tb && i > (da[0].innerWidth || da.innerWidth())) {
                            d = true;
                            Ca = a(".mbsc-cal-tabs .mbsc-cal-tab-sel", N).attr("data-control");
                            ea.addClass("mbsc-cal-tabbed")
                        } else {
                            Ca = "calendar";
                            h = f = "";
                            ea.removeClass("mbsc-cal-tabbed");
                            Va.css({
                                width: "",
                                height: ""
                            })
                        }
                    }
                    if (Sa && aa && ia) {
                        g._isFullScreen = true;
                        d && Va.height(Da.calendar[0].offsetHeight);
                        b = ea[0].offsetHeight;
                        j >= b && ha.height(j - b + ha[0].offsetHeight);
                        h = Math.max(h, Da.calendar[0].offsetHeight)
                    }
                    if (d) {
                        Va.css({
                            width: Sa ? "" : f,
                            height: h
                        });
                        ia && (Y = Math.round(Math.round(ha[0][La ? "offsetHeight" : "offsetWidth"]) / ka))
                    }
                    if (Y) {
                        qa[La ? "height" : "width"](Y);
                        if (Y !== e) {
                            if (Ga) {
                                J = z.maxMonthWidth > a(".mbsc-cal-btnw-m", N).width() ? z.monthNamesShort : z.monthNames;
                                for (y = 0; y < ka; ++y) a(ja[y]).text(J[z.getMonth(z.getDate(oa,
                                    sa - ua + y, 1))])
                            }
                            if (bb) {
                                b = Fa[0][La ? "offsetHeight" : "offsetWidth"];
                                a.extend(ab.settings, {
                                    contSize: b,
                                    snap: b,
                                    minScroll: (2 - lb) * b,
                                    maxScroll: -b
                                });
                                a.extend(X.settings, {
                                    contSize: b,
                                    snap: b,
                                    minScroll: -b,
                                    maxScroll: -b
                                });
                                ab.refresh();
                                X.refresh();
                                Fa.hasClass("mbsc-cal-v") && ab.scroll(gb)
                            }
                            if (Sa && !ra && e) {
                                b = R / e;
                                R = b * Y
                            }
                            l(oa, sa, !e)
                        }
                    } else Y = e;
                    if (d) {
                        a(".mbsc-cal-pnl", N).addClass("mbsc-cal-pnl-h");
                        Da[Ca].removeClass("mbsc-cal-pnl-h")
                    }
                    g.trigger("onCalResize");
                    ra = false
                },
                onHide: function() {
                    rb = [];
                    xa = [];
                    sa = oa = Ca = null;
                    Oa = true;
                    Y = 0;
                    la &&
                        la.destroy();
                    if (bb && ab && X) {
                        ab.destroy();
                        X.destroy()
                    }
                },
                onValidated: function(a) {
                    var b, c, d;
                    c = g.getDate(true);
                    if (pa) b = "calendar";
                    else
                        for (d in g.order) d && g.order[d] === a && (b = /[mdy]/.test(d) ? "date" : "time");
                    g.trigger("onSetDate", {
                        date: c,
                        control: b
                    });
                    K(c);
                    pa = false
                }
            });
            return ma
        }
    })(window, document);
(function(j, k, e) {
    var d = mobiscroll,
        a = d.$,
        b = a.extend,
        c = d.util,
        f = c.datetime,
        h = f.adjustedDate,
        g = d.presets.scroller,
        i = {};
    d.presetShort('calendar');
    g.calendar = function(l) {
        function C(b) {
            if (b) {
                if (u[b]) {
                    return u[b];
                }
                var c = a('<div style="background-color:' + b + ';"></div>').appendTo('body'),
                    f = j.getComputedStyle ? getComputedStyle(c[0]) : c[0].style,
                    d = f.backgroundColor.replace(/rgb|rgba|\(|\)|\s/g, '').split(','),
                    g = d[0] * 0.299 + d[1] * 0.587 + d[2] * 0.114,
                    e = g > 130 ? '#000' : '#fff';
                c.remove();
                u[b] = e;
                return e;
            }
        }

        function o(a) {
            return h(a.getFullYear(), a.getMonth(), a.getDate());
        }

        function B(a) {
            k = {};
            if (a && a.length) {
                for (n = 0; n < a.length; n++) {
                    k[o(a[n])] = a[n];
                }
            }
        }

        function q() {
            l.refresh();
        }
        var r, s, A, n, v, z, t, u = {},
            y = b({}, l.settings),
            d = b(l.settings, i, y),
            x = d.activeClass || '',
            m = d.select == 'multiple' || d.select > 1 || d.selectType == 'week',
            w = c.isNumeric(d.select) ? d.select : Infinity,
            p = !!d.events,
            k = {};
        t = g.calbase.call(this, l);
        r = b({}, t);
        A = d.firstSelectDay === e ? d.firstDay : d.firstSelectDay;
        if (m && d.defaultValue && d.defaultValue.length) {
            for (n = 0; n < d.defaultValue.length; n++) {
                k[o(d.defaultValue[n])] = d.defaultValue[n];
            }
        }
        l.onGenMonth = function(a, b) {
            v = l.prepareObj(d.events || d.marked, a, b);
        };
        l.getDayProps = function(i) {
            var c, j = m ? k[i] !== e : e,
                b = v[i] ? v[i] : false,
                d = b && b[0] && b[0].text,
                h = b && b[0] && b[0].color,
                l = p && d ? C(h) : '',
                f = '',
                g = '';
            if (b) {
                for (c = 0; c < b.length; c++) {
                    if (b[c].icon) {
                        f += '<span class="mbsc-ic mbsc-ic-' + b[c].icon + '"' + (b[c].text ? '' : b[c].color ? ' style="color:' + b[c].color + ';"' : '') + '></span>\n';
                    }
                }
                g = '<div class="mbsc-cal-day-m"><div class="mbsc-cal-day-m-t">';
                for (c = 0; c < b.length; c++) {
                    g += '<div class="mbsc-cal-day-m-c"' + (b[c].color ? ' style="background:' + b[c].color + ';"' : '') + '></div>';
                }
                g += '</div></div>';
            }
            return {
                marked: b,
                selected: j,
                cssClass: b ? 'mbsc-cal-day-marked' : '',
                ariaLabel: p ? d : '',
                markup: p && d ? '<div class="mbsc-cal-day-txt-c"><div class="mbsc-cal-day-txt" title="' + a('<div>' + d + '</div>').text() + '"' + (h ? ' style="background:' + h + ';color:' + l + ';text-shadow:none;"' : '') + '>' + f + d + '</div></div>' : p && f ? '<div class="mbsc-cal-day-ic-c">' + f + '</div>' : b ? g : ''
            };
        };
        l.addValue = function(a) {
            k[o(a)] = a;
            q();
        };
        l.removeValue = function(a) {
            delete k[o(a)];
            q();
        };
        l.setVal = function(a, b, c, d, e) {
            if (m) {
                B(a);
                a = a ? a[0] : null;
            }
            l._setVal(a, b, c, d, e);
            q();
        };
        l.getVal = function(a) {
            if (m) {
                return c.objectToArray(k);
            }
            return l.getDate(a);
        };
        b(t, {
            highlight: !m,
            outerMonthChange: !m,
            parseValue: function(a) {
                var b, c;
                if (m && a && typeof a === 'string') {
                    k = {};
                    a = a.split(',');
                    for (b = 0; b < a.length; b++) {
                        c = f.parseDate(l.format, a[b].replace(/^\s+|\s+$/g, ''), d);
                        k[o(c)] = c;
                    }
                    a = a[0];
                }
                if (m && d.defaultValue && d.defaultValue.length) {
                    d.defaultValue = d.defaultValue[0];
                }
                return r.parseValue.call(this, a);
            },
            formatValue: function(c) {
                var b, a = [];
                if (m) {
                    for (b in k) {
                        a.push(f.formatDate(l.format, k[b], d));
                    }
                    return a.join(', ');
                }
                return r.formatValue.call(this, c);
            },
            onClear: function() {
                if (m) {
                    k = {};
                    l.refresh();
                }
            },
            onBeforeShow: function() {
                if (d.setOnDayTap === e && (!d.buttons || !d.buttons.length)) {
                    d.setOnDayTap = true;
                }
                if (d.setOnDayTap && d.display != 'inline') {
                    d.outerMonthChange = false;
                }
                if (d.counter && m) {
                    d.headerText = function() {
                        var b = 0,
                            c = d.selectType == 'week' ? 7 : 1;
                        a.each(k, function() {
                            b++;
                        });
                        b = Math.round(b / c);
                        return (b > 1 ? d.selectedPluralText || d.selectedText : d.selectedText).replace(/{count}/, b);
                    };
                }
            },
            onMarkupReady: function(c) {
                r.onMarkupReady.call(this, c);
                s = a(c.target);
                if (m) {
                    a('.mbsc-fr-hdr', s).attr('aria-live', 'off');
                    z = b({}, k);
                }
                if (p) {
                    a('.mbsc-cal', s).addClass('mbsc-cal-ev');
                }
            },
            onDayChange: function(i) {
                var j = i.date,
                    b = o(j),
                    r = a(i.target),
                    n = i.selected;
                if (m) {
                    if (d.selectType == 'week') {
                        var f, g, e = b.getDay() - A;
                        e = e < 0 ? 7 + e : e;
                        if (d.select != 'multiple') {
                            k = {};
                        }
                        for (f = 0; f < 7; f++) {
                            g = h(b.getFullYear(), b.getMonth(), b.getDate() - e + f);
                            if (n) {
                                delete k[g];
                            } else if (c.objectToArray(k).length / 7 < w) {
                                k[g] = g;
                            }
                        }
                        q();
                    } else {
                        var p = a('.mbsc-cal .mbsc-cal-day[data-full="' + r.attr('data-full') + '"]', s);
                        if (n) {
                            p.removeClass('mbsc-cal-day-sel').removeAttr('aria-selected').find('.mbsc-cal-day-i').removeClass(x);
                            delete k[b];
                        } else if (c.objectToArray(k).length < w) {
                            p.addClass('mbsc-cal-day-sel').attr('aria-selected', 'true').find('.mbsc-cal-day-i').addClass(x);
                            k[b] = b;
                        }
                    }
                }
                if (d.setOnDayTap && d.select != 'multiple' && d.display != 'inline') {
                    l.needsSlide = false;
                    l.setDate(j);
                    l.select();
                    return false;
                }
            },
            onCancel: function() {
                if (!l.live && m) {
                    k = b({}, z);
                }
            }
        });
        return t;
    };
}(window, document));


(function() {
    var a, c, d = mobiscroll,
        f = d.$,
        g = d.util,
        h = g.testTouch,
        b = g.getCoord;

    function i(g, l) {
        var h = b(l, 'X', true),
            i = b(l, 'Y', true),
            a = g.offset(),
            j = h - a.left,
            k = i - a.top,
            m = Math.max(j, g[0].offsetWidth - j),
            n = Math.max(k, g[0].offsetHeight - k),
            d = 2 * Math.sqrt(Math.pow(m, 2) + Math.pow(n, 2));
        e(c);
        c = f('<span class="mbsc-ripple"></span>').css({
            width: d,
            height: d,
            top: i - a.top - d / 2,
            left: h - a.left - d / 2
        }).appendTo(g);
        setTimeout(function() {
            c.addClass('mbsc-ripple-scaled mbsc-ripple-visible');
        }, 10);
    }

    function e(a) {
        setTimeout(function() {
            if (a) {
                a.removeClass('mbsc-ripple-visible');
                setTimeout(function() {
                    a.remove();
                }, 2000);
            }
        }, 100);
    }
    d.themes.material = {
        addRipple: i,
        removeRipple: function() {
            e(c);
        },
        initRipple: function(k, d, l, m) {
            var g, j;
            k.off('.mbsc-ripple').on('touchstart.mbsc-ripple mousedown.mbsc-ripple', d, function(c) {
                if (h(c, this)) {
                    g = b(c, 'X');
                    j = b(c, 'Y');
                    a = f(this);
                    if (!a.hasClass(l) && !a.hasClass(m)) {
                        i(a, c);
                    } else {
                        a = null;
                    }
                }
            }).on('touchmove.mbsc-ripple mousemove.mbsc-ripple', d, function(d) {
                if (a && Math.abs(b(d, 'X') - g) > 9 || Math.abs(b(d, 'Y') - j) > 9) {
                    e(c);
                    a = null;
                }
            }).on('touchend.mbsc-ripple touchcancel.mbsc-ripple mouseleave.mbsc-ripple mouseup.mbsc-ripple', d, function() {
                if (a) {
                    setTimeout(function() {
                        e(c);
                    }, 100);
                    a = null;
                }
            });
        }
    };
}());

